﻿#include <QApplication>
#include <QTranslator>
#include <QSharedMemory>
#include "logtools.h"

int main(int argc, char *argv[])
{
    qputenv("XDG_RUNTIME_DIR", "/tmp/runtime-root");
    
    if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) {
    	QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    }
    
    QApplication a(argc, argv);

    //防止进程多开
    QSharedMemory shareMem("nfs-logtools");
    if (shareMem.isAttached()) {
        shareMem.detach();
    }
    if (!shareMem.create(1)) {
        qDebug() << shareMem.errorString();
        return -1;
    }

    QTranslator trans;
    trans.load("qt_zh_CN.qm", ":/translation/");
    a.installTranslator(&trans);
    QFont font("Noto Sans CJK SC", 9);
    a.setFont(font);

    Logtools w;
    w.show();
    return a.exec();
}
